package com.hxy.base.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.hxy.base.enums.DeleteStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.Date;

@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = -1758826173926257722L;

    public static final String PROP_ID = "id";
    public static final String PROP_CREATE_BY = "createBy";
    public static final String PROP_CREATE_TIME = "createTime";
    public static final String PROP_UPDATE_BY = "updateBy";
    public static final String PROP_UPDATE_TIME = "updateTime";
    public static final String PROP_IS_DELETE = "isDelete";

    public static final String TF_ID = "id";
    public static final String TF_CREATE_BY = "create_by";
    public static final String TF_CREATE_TIME = "create_time";
    public static final String TF_UPDATE_BY = "update_by";
    public static final String TF_UPDATE_TIME = "update_time";
    public static final String TF_IS_DELETE = "is_delete";


    @TableId(type = IdType.AUTO)
    private Integer id;

    @Builder.Default
    @TableLogic(value = "0", delval = "1")
    private Integer isDelete = DeleteStatus.NOT_DELETE.getValue();

    private Date createTime;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private Integer createBy;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
    private Integer updateBy;
}

